Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

How to get user name from mail file path

I am not 100% sure where you are getting the mail file paths from, e.g. if you are already cycling across person documents in an Address book (if you are, then obv' get user name from person doc field "FullName"), following assumes you are not.

You could create a view in names.nsf by mail file path, but I am pretty sure you will not be allowed to do that(?), if you can, then getDocumentByKey(mailFilePath). How many names are in the names.nsf? Is it Full Text Indexed (you may be hitting multiple servers)? If FTI, then will be simpler, if not FTI'd then depending on frequency and some other bits I don't know about your application, you will probably have to cycle through person docs in names.nsf, and depending on how big the NAB this, that processing could be way too slow, so maybe poll every x and store results somewhere else.

One thing to be careful of, mail file paths in person doc might be "mail\nwall" or "mail\nwall.nsf"

Think you are DIIOP'ing to Domino...? If code is running on Notes\ Domino, then you could use the http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=OpenNTF%20Domino%20API to resolve all the recycle\ enumeration stuff.

Else, something like this should work (I knocked this up in a Notes Java Agent, so access to Session etc. already available):

Database db_nab = session.getDatabase("someserver/somedomain", "names.nsf");
View vw_nab = db_nab.getView("($VIMPeople)");
String s_user_name = "";
DocumentCollection dc_nab = null;
Document doc_nab = null;
Document doc_next = null;

String TEST_PATH = "mail\\nwall";

// If names.nsf is FTI'd, maybe you just search for CONTAINS, would take care of "mail\nwall" or "mail\nwall.nsf"
dc_nab = db_nab.FTSearch("FIELD form=\"Person\" AND FIELD MailFile=\"" + TEST_PATH + "\"", 0);

System.out.println("...dc_nab.count: " + dc_nab.getCount());
if (dc_nab.getCount()==1){
doc_nab = dc_nab.getFirstDocument();
// FullName field is acuually an array of values, but for simplicity sake
s_user_name = doc_nab.getItemValueString("FullName");
System.out.println("...s_user_name=" + s_user_name);
}else{
// You have some sort of duplicate issue
}

//If you don't have FTI, then bit more of a hassle.
doc_nab = vw_nab.getFirstDocument();
while(doc_nab!=null){
doc_next = vw_nab.getNextDocument(doc_nab);

if(doc_nab.getItemValueString("MailFile").equalsIgnoreCase(TEST_PATH)){
// Found match. you may need to continue checking, in case of a dup
}

doc_nab.recycle();
doc_nab = doc_next;
}


Feedback response number WEBB9A6DGV created by ~Holly Quetfookony on 08/01/2013

How to get the user name by a mail ... (~Lex Chuluthery... 1.Aug.13)
. . Calendar Profile Document (~Michelle Elhip... 1.Aug.13)
. . look in the NAB (~Judy Ektumizen... 1.Aug.13)
. . How to get user name from mail file... (~Holly Quetfook... 1.Aug.13)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS